package com.qianli.cashmama.trade.common.enums;

/**
 * Created with IntelliJ IDEA.
 * User: sm
 * Date: 2017/8/1
 * Time: 下午2:48
 */
public enum TradeDiscountStatusEnum {
    NOT_VERIFIED(1, "NOT_VERIFIED", "未核销"),
    VERIFIED(2, "VERIFIED", "已核销");

    private int type;
    private String code;
    private String msg;

    TradeDiscountStatusEnum(int type, String code, String msg) {
        this.type = type;
        this.code = code;
        this.msg = msg;
    }

    public int getType() {
        return type;
    }

    public TradeDiscountStatusEnum setType(int type) {
        this.type = type;
        return this;
    }

    public String getCode() {
        return code;
    }

    public TradeDiscountStatusEnum setCode(String code) {
        this.code = code;
        return this;
    }

    public String getMsg() {
        return msg;
    }

    public TradeDiscountStatusEnum setMsg(String msg) {
        this.msg = msg;
        return this;
    }

    public static TradeDiscountStatusEnum convertByType(int type) {
        TradeDiscountStatusEnum discountStatusEnum = null;
        for (TradeDiscountStatusEnum statusEnum : TradeDiscountStatusEnum.values()) {
            if (statusEnum.getType() == type) {
                discountStatusEnum = statusEnum;
                break;
            }
        }

        return discountStatusEnum;
    }
}
